<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>httpDelete</title>
</head>

<body>
    <script>
        const httpDelete = (url, callback, error = console.error) => {
            const request = new XMLHttpRequest();
            request.open('DELETE', url, true);
            request.onload = () => callback(request);
            request.onerror = () => error(request);
            request.send();
        }
        httpDelete('https://jsonplaceholder.typicode.com/posts/1', request => {
            console.log(request.responseText);
            document.write(request.responseText)
        }); // Logs: {}
    </script>
</body>

</html>